package com.tanhua.controller;

import com.tanhua.service.CommentsService;
import com.tanhua.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/comments")
public class CommentsController {


    @Autowired
    private CommentsService commentsService;

    @GetMapping
    public ResponseEntity comments(String movementId,
                                   @RequestParam(defaultValue = "1") Integer page,
                                   @RequestParam(defaultValue = "10") Integer pagesize){
        PageResult pr =  commentsService.findByPage(movementId,page,pagesize);
        return ResponseEntity.ok(pr);
    }


}
